package com.kgc.activityprovider.service.impl;

import com.kgc.activiti.util.ResponseMsg;
import com.kgc.activityprovider.dao.InventoryCheckMapper;
import com.kgc.activityprovider.service.WorkFlowUtilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class InventoryCheckWorkFlowServiceImpl implements WorkFlowUtilService {

    @Autowired
    private InventoryCheckMapper inventoryCheckMapper;
    @Override
    public ResponseMsg changeStatus(String code, int status) {
        ResponseMsg msg = new ResponseMsg();
        int changeCount = inventoryCheckMapper.changeStatus(code, status);
        if(changeCount>0){
            msg.setData(status);
            msg.setCode("200");
        }else{
            msg.setData(status);
            msg.setCode("201");
        }
        return msg;
    }

    @Override
    public ResponseMsg insertCheck(String code, Integer checkManId, String checkComment) {
        ResponseMsg msg = new ResponseMsg();
        int updateCount = inventoryCheckMapper.insertCheck(code, checkManId, checkComment);
        if(updateCount>0){
            msg.setData(true);
            msg.setCode("200");
        }else{
            msg.setData(false);
            msg.setCode("201");
        }
        return msg;
    }

    @Override
    public ResponseMsg sendEmail(String code, String emailTo) {
        return null;
    }
}
